<?php
// Prevenir que jquery se cargue dos veces
Yii::app()->clientScript->scriptMap['jquery.js'] = false;
Util::tsRegisterAssetJs('_form_modal.js');
$form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array(
    'type' => 'horizontal',
    'id' => 'direccion-form',
    'enableAjaxValidation' => false,
    'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => false,),
    'enableClientValidation' => true,
        ));
?>
<div class="modal-header">
    <a class="close" data-dismiss="modal">&times;</a>
    <h4><i class="icon-home"></i> Registrar Dirección</h4>
</div>
<div class="modal-body">

    <?php echo $form->textFieldRow($model, 'calle_1', array('maxlength' => 128)) ?>

    <?php echo $form->textFieldRow($model, 'calle_2', array('maxlength' => 128)) ?>

    <?php echo $form->textFieldRow($model, 'ciudad', array('maxlength' => 32)) ?>

    <?php echo $form->textFieldRow($model, 'estado', array('maxlength' => 32)) ?>

    <?php echo $form->textFieldRow($model, 'codigo_postal', array('maxlength' => 16)) ?>

    <?php echo $form->textFieldRow($model, 'pais', array('maxlength' => 32)) ?>

    <?php echo $form->textFieldRow($model, 'direccioncol', array('maxlength' => 45)) ?>


    <label class="control-label required" for="medio">Facturacion </label>

    <div class="controls">
        <?php
        $this->widget(
                'ext.bootstrap.widgets.TbToggleButton', array(
            'model' => $model,
            'disabledLabel' => 'NO',
            'enabledLabel' => 'SI',
            'width' => 150,
            'value' => false,
            'enabledStyle' => 'warning',
            'disabledStyle' => 'primary',
            'attribute' => 'facturacion',
                )
        );
        ?>
    </div>

    <label class="control-label required" for="medio">Entrega </label>

    <div class="controls">
        <?php
        $this->widget(
                'ext.bootstrap.widgets.TbToggleButton', array(
            'model' => $model,
            'disabledLabel' => 'NO',
            'enabledLabel' => 'SI',
            'width' => 150,
            'enabledStyle' => 'warning',
            'disabledStyle' => 'primary',
            'attribute' => 'entrega',
                )
        );
        ?>
    </div>
    <?php echo $form->hiddenField($model, 'entidad_tipo') ?>

    <?php echo $form->hiddenField($model, 'entidad_id') ?>

</div>

<div class="modal-footer">
    <?php
    $this->widget('bootstrap.widgets.TbButton', array(
        'type' => 'success',
        'icon' => 'ok',
        'label' => $model->isNewRecord ? Yii::t('AweCrud.app', 'Create') : Yii::t('AweCrud.app', 'Save'),
        'htmlOptions' => array(
            'onClick' => 'js:agregarDireccionContacto("#direccion-form")')
    ));
    ?>
    <?php
    $this->widget('bootstrap.widgets.TbButton', array(
        'icon' => 'remove',
        'label' => Yii::t('AweCrud.app', 'Cancel'),
        'htmlOptions' => array(
            'data-dismiss' => 'modal',)
    ));
    ?>

</div>
<?php $this->endWidget(); ?>
